package com.neuedu.my12306.web;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.neuedu.my12306.entity.TicketInfo;
import com.neuedu.my12306.service.ITicketInforService;
import com.neuedu.my12306.service.impl.ITicketInfoServiceImpl;

/**
 * Servlet implementation class ToEditTicketServlet
 */
@WebServlet("/ToEditTicketServlet.do")
public class ToEditTicketServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
    private ITicketInforService iTicketInforService;
    public ToEditTicketServlet() {
        super();
        iTicketInforService =new ITicketInfoServiceImpl();
       
    }

	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//1.在接收数据前进行编码转换(统一使用过滤器转换)
		String id = request.getParameter("id");
		int tid = Integer.parseInt(id);
		TicketInfo ticketInfo =iTicketInforService.findTicketInfoById(tid);
		request.setAttribute("ticket", ticketInfo);
		request.getRequestDispatcher("Admin/TicketManageInfo_Amin_Edit.jsp").forward(request, response);
		
	}

}
